﻿@model sBlog.Net.Domain.Entities.UserEntity
<h2>
    Update Face for author @Model.UserDisplayName</h2>
<script language="javascript">
    $(window).load(
    function () {
        $("#dvUpload").fileUpload({
            'uploader': '/Scripts/uploader.swf',
            'cancelImg': '/Content/Images/cancel.png',
            'buttonText': 'Browser Image',
            'script': '/Home/UploadUserAvatarFace',
            'onComplete': function (event, queueID, fileObj, response, data) {
                updateAvatarFace(response);
            },
            'folder': '/UploadUserAvatarFace',
            'fileDesc': 'Image Files',
            'fileExt': '*.jpg',
            'multi': false,
            'auto': true
        });
    }
    );

    function updateAvatarFace(avatar) {
        var noCache = new Date().toString();
        var userID = '@Model.UserID';
        $.getJSON('/Author/updateAvatarFace?Avatar=' + avatar + '&userId=' + userID, { noCache: noCache }, function (data) {
            var imgUrl = "http://s1.img.yan.vn/Mlog/UploadUserAvatarFace/129x129_" + data;
            $("#avatar").attr("src", imgUrl).fadeIn('normal');
        });
    }
</script>
@using (Html.BeginForm())
{
    @Html.Hidden("UserID", Model.UserID)
    <img src="@Url.Content("http://s1.img.yan.vn/Mlog/UploadUserAvatarFace/129x129_" + Model.AvatarFace)" width="129" height="129" alt="Avatar Face" id="avatar"/>
    <div id="uploadAvatar">
        <div id="dvUpload">
            @Html.Hidden("AvatarFace")
        </div>
    </div>
    <b>Order number</b><br />
    <br />
    @Html.TextBox("OrderNumber")
    <br />
    <br />
    <b>Title</b><br />
    <br />
    @Html.TextBox("Title")
    <br />
    <br />
    <input type="submit" value="update" />
}
